<?php /*a:5:{s:57:"/home/pirate/wx_manager/app/appmenu/view/admin/index.html";i:1608022792;s:35:"../app/common/admin/lib/header.html";i:1622026634;s:36:"../app/common/admin/lib/sidebar.html";i:1606282475;s:46:"../app/common/admin/lib/app_custom_select.html";i:1606381281;s:35:"../app/common/admin/lib/footer.html";i:1620273611;}*/ ?>
<?php
use app\common\model\User;
?>
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title><?php if($title): ?><?php echo htmlentities($title); ?>-<?php endif; ?>微信后台管理</title>
  <base href="<?php echo htmlentities(SITE_URL); ?>/"></base>
  <script type="text/javascript">
    var siteUrl = "<?php echo htmlentities(SITE_URL); ?>";
    var uploadUrl = "<?php echo htmlentities(UPLOAD_URL); ?>";
    var isAdmin = 1;
  </script>
  
  <link rel="stylesheet" type="text/css" href="./static/css/base.css" />
  <link rel="stylesheet" type="text/css" href="./static/css/admin/admin.css" />
  <link rel="stylesheet" href="/static/lib/layui-v2.5.4/css/layui.css" media="all">

  <?php if(in_array($module, explode(',', ',autoreply,appmsg,appmenu,appmenu_stat,key_stat,message,user'))): ?>
  <link rel="stylesheet" type="text/css" href="./static/css/admin/weixin.css" />
  <?php endif; ?>

  <script type="text/javascript" src="./static/js/jquery-1.7.1.min.js"></script>
  <script type="text/javascript" src="./static/js/jqueryui/1.8.11/jquery-ui.js"></script>
  <script type="text/javascript" src="./static/js/common.js"></script>
  <script type="text/javascript" src="./static/js/admin/admin.js"></script>
  <script type="text/javascript" src="./static/js/qDialog.js"></script>
  <script type="text/javascript" src="./static/js/zclip/jquery.zclip.min.js"></script>
  <script type="text/javascript" src="./static/js/zclip/ZeroClipboard.js"></script>
  <link rel="shortcut icon" href="./favicon.ico">
  <script src="/static/lib/layui-v2.5.4/layui.js?v=1.0.4" charset="utf-8"></script>
  <script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
  <link rel="stylesheet" href="/static//css/admin/weiboface.css" type="text/css" />
  <script type="text/javascript" src="/static//js/weiboface.js"></script>
  <!--[if IE 6]>
  <script src="./static/js/DD_belatedPNG_0.0.8a-min.js"></script>
  <script>
    DD_belatedPNG.fix('.logo a,.n-icon');
  </script>
  <![endif]-->
  <script>
  $(function(){
    // 页面高度
    var windowHeight = $(window).height();
    var domHeight = $(document).height();
    if (domHeight > windowHeight) {
      windowHeight = domHeight;
    }
    if ($(".inner-center").height() < windowHeight - 66) {
      $(".inner-center").css('min-height', windowHeight - 66);
      //$('body').css('overflow', 'hidden');
    }
    
    // 用户设置浮层
    $(".js_userSetBtn").click(function(e){
     e.preventDefault();
     e.stopPropagation();
     
     $(".js_cardSetBox").addClass('hidden');
     if ($(".js_userSetBox").hasClass('hidden')) {
       $(".js_userSetBox").removeClass('hidden');
     } else {
       $(".js_userSetBox").addClass('hidden');
     }
    });

      // 公众号下拉浮层
      $(".js_cardSetBtn").click(function(e){
          e.preventDefault();
          e.stopPropagation();

          $(".js_userSetBox").addClass('hidden');
          if ($(".js_cardSetBox").hasClass('hidden')) {
              $(".js_cardSetBox").removeClass('hidden');
          } else {
              $(".js_cardSetBox").addClass('hidden');
          }
      });

      // 表情初始化
      weiboFaceInit({
          //emotionUrl: "javascript:;",
          data: <?php echo config('emotion.weixin_emotions'); ?>
      });
  });
  </script>
</head>
<body>

<div id="wrap">
  <div class="header">
    <div class="htop clearfix">
      
      <h1 class="logo left" style="width:300px;"><a href="<?php echo url('admin'); ?>">微信后台管理 [<?php echo htmlentities($open_card_info['title']); ?>] </h1>
      <?php if($user_id > 0): ?>
        
        <div class="infotop">
          <a href="javascript:void(0);" class="userpic"></a>
          <span class="username-right js_userSetBtn">
            <a href="javascript:;" class="username"><?php echo User::display_name($user_id); ?></a>
            <span class="arrowtop">
              <i></i>
            </span>
          </span>
          <div class="poptop poptop-user js_userSetBox hidden" style="background:white;">
            <em>◆</em>
            <ul>
              
              <li><a href="<?php echo url('home'); ?>">回前台</a></li>
              <li><a href="<?php echo url('/admin/logout/index'); ?>">退出</a></li>
            </ul>
          </div>
        </div>
      <?php else: ?>
        <div class="htop-login right">
          <a href="<?php echo url('admin'); ?>">登录</a>
          <a href="<?php echo url('user/register'); ?>">注册</a>
        </div>
      <?php endif; ?>
    </div>
  </div>
  <div class="container clearfix">
    <div class="sidebar left">
  <ul class="sidenav">
  <!-- {an_dump($sidebar_menu_list)} -->
    <?php foreach($sidebar_menu_list as $k=>$v): ?>
    <li class="js_topMenu">
      <a href="javascript:;"><?php echo htmlentities($v['title']); ?><em></em></a>
      <?php if($v['children']): ?>
      <ul class="sidenav2" style="display:none;">
        <?php foreach($v['children'] as $k1=>$v1): ?>
        <li class="<?php echo htmlentities($v1['curr']); ?>">
          <a href="<?php echo htmlentities($v1['url']); ?>" data-qian="vmodule::<?php echo htmlentities($v1['module']); ?> vcontroller::<?php echo htmlentities($v1['controller']); ?> vaction::<?php echo htmlentities($v1['action']); ?> ___ module::<?php echo htmlentities($module); ?> controller::<?php echo htmlentities($controller); ?> action::<?php echo htmlentities($action); ?> __ vextra::<?php echo htmlentities($v1['extra_res']); ?> extra::<?php echo htmlentities($extra_res); ?> vcurr::<?php echo htmlentities($v1['curr']); ?>"><?php echo htmlentities($v1['title']); ?>&nbsp;&nbsp;<i style="display:none;" style="color:red">(0)</i></a>
        </li>
        <?php endforeach; ?>
      </ul>
      <?php endif; ?>
    </li>
    <?php endforeach; ?>
  </ul>
</div>
<script>
$(function(){
  $('.js_topMenu').click(function(e){
    
    var s=e.target || e.srcElement;
    if ($(s).parents(".sidenav2").size()>0) {
      return;
    }

    $(this).siblings().removeClass('curr')
    $(this).siblings().find('ul:visible').slideUp();
    if (!$(this).find('ul:visible').length) {
      $(this).find('ul').slideDown();
      $(this).addClass('curr');
    } else {
      $(this).find('ul').slideUp();
      $(this).removeClass('curr');
    }
  });
  
  $(".sidenav2 li").each(function(i, n){
    if ($(this).hasClass('curr')) {
      $(this).closest('ul').show();
      $(this).closest('.js_topMenu').addClass('curr');
    };
  });
});
</script>
    <div class="center">
      <div class="inner-center">
  <div class="menubox" style="width:auto;">
    <div class="menu-top clearfix">
      <div class="btn-area right">
        <?php if($store_id): ?>
        <a href="<?php echo url('/appmenu/bind_menu/index'); ?>" title="成功授权了菜单接口，才能同步信息" class="btn btn-primary btn-sm js_bindMenu">重新授权</a>
        <a href="javascript:void(0);" title="同步到微信公众号" class="btn btn-success btn-sm js_syncMenu">同步微信菜单</a>
        <a href="javascript:void(0);" title="取消微信公众号的菜单" class="btn btn-danger btn-sm js_clearMenu">取消微信菜单</a>
        <?php else: ?>
        <!--<a href="javascript:void(0);" title="同步到微信公众号" class="btn btn-success btn-sm js_syncMenu">同步店铺微信菜单</a>-->
        <!--<a href="javascript:void(0);" title="取消微信公众号的菜单" class="btn btn-danger btn-sm js_clearSpecialMenu">取消店铺微信菜单</a>-->
        <?php endif; ?>
        <a href="<?php echo url('/appmenu/admin/sort_menu'); ?>" title="重新为菜单排序" class="btn btn-default btn-sm">拖动排序</a>
        <a href="javascript:void(0);" title="预览菜单的真实效果" class="btn btn-info btn-sm js_showPreview">菜单预览</a>
      </div>
      <span class="tit5">自定义菜单设置管理</span>
    </div>
    <dl class="alert" style="margin-top:20px;">
      <dt>特别提示：</dt>
      <dd>
        <p>你可以创建最多<span class="color"> 3 个一级菜单</span>，每个一级菜单下可以创建最多<span class="color"> 5 个二级菜单</span></p>
        <p>编辑中的菜单不会马上被用户看到，可以放心调试。点击右上角的“同步微信菜单”才会使更改生效。</p>
        <p>点击“同步微信菜单”同步成功后，一般不会立即生效，微信官方说法是24小时以内生效。可试着用取消关注重新关注的方式来查看效果。</p>
      </dd>
    </dl>
    <div class="menu-main clearfix">
      <?php foreach($menu_lenth_arr as $k=>$v): ?>
      <div class="level <?php if($k == 2): ?>nomr<?php endif; ?>">
        
        <div class="showmenu menuOuterBox">
          <dl class="menu-list">
            
            <dt class="clearfix js_parentMenu js_menuDD" data-id="<?php echo htmlentities($menu_list[$k]['id']); ?>" data-content-type="<?php echo htmlentities($menu_list[$k]['type']); ?>">
              
              <div class="bar clearfix js_parentPlaceBox" <?php if(isset($menu_list[$k])): ?> style="display:none;" <?php endif; ?>>
                <span class="menutit left">添加一级菜单</span>
                <a href="javascript:void(0);" class="btn btn-success btn-xs right js_addParentMenuBtn" style="display:none;">添加</a>
              </div>
              
              <div class="barfill clearfix js_menuItem" <?php if(!isset($menu_list[$k])): ?>style="display:none;"<?php endif; ?>>
                <span class="menutit fs18 left"><?php echo htmlentities($menu_list[$k]['title']); ?></span>
                <div class="icon-shop right">
                  <a href="javascript:void(0);" title="添加子菜单" class="icons icon-add2 <?php if($menu_list[$k]['son_list'] && count($menu_list[$k]['son_list']) >= 5): ?>icon-add2-disabled<?php endif; ?> js_addSonBtn"></a>
                  <a href="javascript:void(0);" title="设置菜单回复" class="icons icon-link <?php if($menu_list[$k]['son_list']): ?>icon-link-disabled<?php endif; ?> js_setBtn"></a>
                  <a href="javascript:void(0);" title="编辑菜单标题" class="icons icon-edit js_editBtn"></a>
                  <a href="javascript:void(0);" title="删除菜单" class="icons icon-del  js_delBtn"></a>
                </div>
              </div>
              
              <div class="barfill clearfix js_inputBox" style="display:none;">
                <input type="text" class="titfill left js_input" value="<?php echo htmlentities($menu_list[$k]['title']); ?>">
                <a href="javascript:void(0);" class="btn btn-success btn-xs right js_okBtn">确定</a>
              </div>
            </dt>
            
            <?php foreach($menu_list[$k]['son_list'] as $k1=>$v1): ?>
              <dd class="js_sonMenu js_menuDD" data-id="<?php echo htmlentities($v1['id']); ?>" data-parent-id="<?php echo htmlentities($v1['parent_id']); ?>" data-content-type="<?php echo htmlentities($v1['type']); ?>">
                
                <div class="submenu clearfix js_menuItem">
                  <span class="menutit left"><?php echo htmlentities($v1['title']); ?></span>
                  <div class="icon-shop right">
                    <a href="javascript:void(0);" title="设置菜单回复" class="icons icon-link js_setBtn"></a>
                    <a href="javascript:void(0);" title="编辑菜单标题" class="icons icon-edit js_editBtn"></a>
                    <a href="javascript:void(0);" title="删除菜单" class="icons icon-del js_delBtn"></a>
                  </div>
                </div>
                
                <div class="submenu clearfix js_inputBox" style="display:none;">
                  <input type="text" class="titfill left js_input" value="<?php echo htmlentities($v1['title']); ?>">
                  <a href="javascript:void(0);" class="btn btn-success btn-xs right js_okBtn">确定</a>
                </div>
              </dd>
            <?php endforeach; ?>
            <dd style="display:none;" class="js_sonBak js_menuDD">
              <div class="submenu clearfix js_menuItem" style="display:none;">
                <span class="menutit left"><?php echo htmlentities($v1['title']); ?></span>
                <div class="icon-shop right">
                  <a href="javascript:void(0);" title="设置菜单回复" class="icons icon-link js_setBtn"></a>
                  <a href="javascript:void(0);" title="编辑菜单标题" class="icons icon-edit js_editBtn"></a>
                  <a href="javascript:void(0);" title="删除菜单" class="icons icon-del js_delBtn"></a>
                </div>
              </div>
              <div class="submenu clearfix js_inputBox">
                <input type="text" class="titfill left js_input" value="添加一级菜单1">
                <a href="javascript:void(0);" class="btn btn-success btn-xs right js_okBtn">确定</a>
              </div>
            </dd>
          </dl>
        </div>
      </div>
      <?php endforeach; ?>
    </div><!--end .menu-main-->
  </div>


<?php echo htmlentities($select_app_list = config('admin.select_app_list')); ?>
<?php echo htmlentities($select_query    = config('admin.select_query')); ?>
<div class="hidden js_AppCustomHideBox">
  <div class="float-define">
    <table>
      <tr class="float-set-rule2">
        <td valign="top" align="right" style="width:116px;"><label for="">回复类型：</label></td>
        <td>
          <p>将从
            <select name="appType" class="js_typeSelect">
              <?php foreach($select_app_list as $k=>$v): ?>
              <option value="<?php echo htmlentities($k); ?>"><?php echo htmlentities($v['title']); ?></option>
              <?php endforeach; ?>
            </select>
            <?php foreach($select_app_list as $k=>$v): if(empty($v['child'])): ?>{continue}<?php endif; ?>
            <select name="appSubType" class="js_sonTypeSelect<?php echo htmlentities($k); ?> js_sonTypeSelect hidden">
              <?php foreach($v['child'] as $k1=>$v1): ?>
              <option value="<?php echo htmlentities($k1); ?>"><?php echo htmlentities($v1); ?></option>
              <?php endforeach; ?>
            </select>
            <?php endforeach; ?>中
            <span class="float-set-toadd js_addMoreBox">没有合适的，去<a target="_blank" href="<?php echo url('/article/admin/add'); ?>">添加</a></span>
          </p>
          <p>取出
            <select name="" class="js_queryType">
              <?php foreach($select_query as $k=>$v): ?>
              <option value="<?php echo htmlentities($k); ?>"><?php echo htmlentities($v); ?></option>
              <?php endforeach; ?>
            </select>

            <input type="text" value="1" class="js_queryNum"> 条
          </p>
        </td>
      </tr>

      <tr class="js_customSelectBox hidden">
        <td valign="top" align="right"><label for="">选择内容：</label></td>
        <td>
          <div class="float-choose clearfix">
            <div class="float-choose-l left">
              <div class="search-level1 clearfix">
                <input type="text" class="left" id="keywords">
                <button type="button" id="keysBtn" class="btn btn-success btn-xs right">搜索</button>
              </div>
              <div id="js_loadBox">

              </div>
            </div>
            <div class="float-choose-arrow left"></div>
            <!--start:已选择的资源-->
            <div class="float-choose-l right">
              <div class="float-choose-title clearfix">已选择的内容：</div>
              <ul class="float-choose-list" id="js_selBox">
              </ul>
            </div>
            <!--end:已选择的资源-->
          </div>
        </td>
      </tr>
    </table>
  </div>
</div>
<script type="text/javascript" src="./static/js/appCustomSelect.js"></script>
<script>
var appmenuResname = "<?php echo htmlentities($res_name); ?>";
var storeId        = '<?php echo htmlentities($store_id); ?>';

var miniprogramDevide = "{appmenu_config::$miniprogram_devide}";

var fillParent = '添加一级菜单';
var fillSon    = '添加子菜单';
function isSonBoxShow(){
  $('.js_parentBox').each(function(){
    if ($(this).find('.js_sonBox:visible').length) {
      $(this).find('.js_parentTitle').addClass('js_open').removeClass('js_close');

    } else {
      $(this).find('.js_parentTitle').removeClass('js_open').addClass('js_close');
    }
  });
}
function setMenuLiWidth(){
  //var totalWidth = $('.js_menuOutBox').width();
  var liNum      = $('.js_parentBox').length;
  var widthCss = '33%';
  if (liNum == 1) {
    widthCss = '100%';
    $('.js_parentBox').css({ 'width':widthCss });
    var parentWidth = $('.js_parentBox').width();
    var sonWidth1   = $('.js_sonBox').eq(0).width() + 28;
    var left1       = (parentWidth - sonWidth1) / 2;
    $('.js_sonBox').eq(0).css({ 'left':left1+'px' });
  } else if (liNum == 2) {
    widthCss = '50%';
    $('.js_parentBox').css({ 'width':widthCss });
    var parentWidth = $('.js_parentBox').width();
    var sonWidth1   =  $('.js_sonBox').eq(0).width() + 28;
    var sonWidth2   =  $('.js_sonBox').eq(1).width() + 28;
    var left1       = (parentWidth - sonWidth1) / 2;
    $('.js_sonBox').eq(0).css({ 'left':left1+'px' });
    if (sonWidth2 <= parentWidth) {
      var left2     = (parentWidth - sonWidth2) / 2;
      $('.js_sonBox').eq(1).css({ 'left':left2+'px' });
    } else {
      $('.js_sonBox').eq(1).css({ 'right':'5px' });
      $('.js_sonBox em').eq(1).css({ 'margin-left':'auto', 'left':'auto', 'right':'45px' });
    }
  } else {
    $('.js_parentBox').css({ 'width':widthCss });
    var parentWidth = $('.js_parentBox').width();
    var sonWidth1   =  $('.js_sonBox').eq(0).width() + 28;
    var sonWidth2   =  $('.js_sonBox').eq(1).width() + 28;
    var sonWidth3   =  $('.js_sonBox').eq(2).width() + 28;
    var left1       = (parentWidth - sonWidth1) / 2;
    var left2       = (parentWidth - sonWidth2) / 2;
    $('.js_sonBox').eq(0).css({ 'left':left1+'px' });
    $('.js_sonBox').eq(1).css({ 'left':left2+'px' });
    if (sonWidth3 <= parentWidth) {
      var left3     = (parentWidth - sonWidth3) / 2;
      $('.js_sonBox').eq(2).css({ 'left':left3+'px' });
    } else {
      $('.js_sonBox').eq(2).css({ 'right':'5px' });
      $('.js_sonBox em').eq(2).css({ 'margin-left':'auto', 'left':'auto', 'right':'30px' });
    }
  }
}
$(function(){
  // 把预览自定义菜单
  $('#wrap').append('<div class="float-bg hidden js_priviewBg"></div><div class="float-menu js_previewMenuBox hidden"></div>');
  $('.js_showPreview').on('click', function(){
    $('.js_priviewBg').show();
    $('.js_priviewBg').removeClass('hidden');
    $('.js_previewMenuBox').show();
    $('.js_previewMenuBox').removeClass('hidden');
    $('.js_previewMenuBox').load(siteUrl+'/appmenu/admin/load_menu_preview?store_id='+storeId, function(){
      setMenuLiWidth();
    });
  });

  $('.js_parentTitle').live('click', function(){
    $('.js_sonBox').hide();
    var thisObj = $(this);
    if (thisObj.closest('.js_parentBox').find('ul').hasClass('js_noSon')) {
      isSonBoxShow();
      return;
    }
    if (thisObj.hasClass('js_close')) {
      thisObj.removeClass('js_close').addClass('js_open');
      thisObj.closest('.js_parentBox').find('.js_sonBox').show();
    } else {
      thisObj.removeClass('js_open').addClass('js_close');
      thisObj.closest('.js_parentBox').find('.js_sonBox').hide();
    }
    isSonBoxShow();
  });
  $('.js_closePreview').live('click', function(){
    $('.js_previewMenuBox').hide();
    $('.js_priviewBg').hide();
  });
  
  // 初始菜单hover出添加按扭
  $(".js_parentPlaceBox").hover(
    function(){
      $(this).find(".js_addParentMenuBtn").show();
    },
    function(){
      $(this).find(".js_addParentMenuBtn").hide();
    }
  );
  
  // 初始时一级菜单点击增加变输入框
  $(".js_addParentMenuBtn").live('click', function(){
    $(this).closest('dt').find('.js_parentPlaceBox').hide();
    $(this).closest('dt').find('.js_inputBox').show();
    
    inputPlaceHold($(this).closest('dt').find(".js_input"), fillParent);
  });
  
  // 添加子菜单
  $(".js_addSonBtn").live('click', function(e){
    var thisClosest = $(this).closest('dl');

    if (getSonNum(thisClosest) >= 5) {
      showMsg('最多只能有5个子菜单');
      return false;
    }
    
    thisClosest.find(".js_sonBak").before(thisClosest.find(".js_sonBak").clone());
    var currObj = thisClosest.find(".js_sonBak").eq(0);
    currObj.attr({ 'data-parent-id':thisClosest.find(".js_parentMenu").attr('data-id') }).removeClass("js_sonBak").addClass("js_sonMenu").show();
    
    inputPlaceHold(currObj.find(".js_input"), fillSon);
    
    // 控制小图标样式
    if (thisClosest.find(".js_sonMenu").length > 0) {
      var parentObj = thisClosest.find(".js_parentMenu");
      parentObj.find(".js_setBtn").addClass("icon-link-disabled");
      
      if (thisClosest.find(".js_sonMenu").length >= 5) {
        parentObj.find(".js_addSonBtn").addClass("icon-add2-disabled");
      }
    }
  });
  
  // 编辑菜单
  $(".js_editBtn").live('click', function(e){
      var thisClosest = $(this).closest(".js_menuItem");
      var title = thisClosest.find('menutit').text();
      
      thisClosest.hide();
      thisClosest.next().show();
      thisClosest.next().find(".js_input").text(title);
      var fill = fillParent;
      
      // 子级
      if (thisClosest.closest(".js_parentMenu").length < 0) {
        fill = fillSon;
      }
      inputPlaceHold(thisClosest.next().find(".js_input"), fill, 1);
  });
  
  // 设置菜单
  $(".js_setBtn").live('click', function(){
    var thisObj     = $(this);
    var menuDD      = $(this).closest(".js_menuDD");
    var id          = menuDD.attr('data-id');
    var parentId    = menuDD.attr('data-parent-id');
    var contentType = menuDD.attr('data-content-type');

    $(".currEditMenu").removeClass('currEditMenu');
    menuDD.addClass('currEditMenu');
    //showMsg(contentType);
    
    if ((typeof parentId == "undefined" || parentId < 1) && menuDD.closest('dl').find(".js_sonMenu").length > 0) {
      showMsg('不能设置含有子菜单的父级菜单');
      return false;
    }
    
    // 如果已有了内容
    if (contentType > 0) {
      var msgType = contentType;
      var currId   = $(".currEditMenu").attr('data-id');
      
      var html  = '<div class="float-prompt-con">\
                   <div class="float-pic-info" style="position:relative;"">您设置菜单的回复内容如下，&nbsp;\
                    <a href="javascript:void(0);" class="js_setBtn2">点击去更改</a>\
                    <div class="linkpop js_menuSetBox2" style="display:none; left:40px; top:26px; z-index:555;">\
                      <div class="inner-linkpop">\
                        <span>\
                          <i class="arrowpop"></i>\
                          <b class="arrowpop2"></b>\
                        </span>\
                        <div class="options-list">\
                          <!-- <a class="js_menuIndexBtn" href="javascript:void(0);">关联到微官网</a>-->\
                          <a class="js_menuLinkBtn" href="javascript:void(0);">跳转到网页</a>\
                          <a class="js_menuTextBtn" href="javascript:void(0);">纯文字回复</a>\
                          <a class="js_menuSingleBtn" href="javascript:void(0);">单条图文信息</a>\
                          <a class="js_menuMultiBtn" href="javascript:void(0);">多条图文信息</a>\
                          <!--<a class="js_menuMinipBtn" href="javascript:void(0);">关联小程序</a>-->\
                          <!--<a class="js_menuCustomBtn" href="javascript:void(0);">智能回复</a>-->\
                        </div>\
                      </div>\
                    </div>\
                  </div>';
      html += '<div class="js_msgList"><img src="'+siteUrl+'/static/images/loading2.gif"></div></div>';
      
      ace.dialog({
        'title':'已设置的菜单项',
        'content':html,
        'init':function(){
          $(".aceDialog").width(650);
          if (msgType == 30 || msgType == 40 || msgType == 50) {
            $(".aceContent").height(400);
          } else {
            //$(".aceContent").css({ 'min-height':'auto' });
          }
          
          setTimeout(function(){
            resetDialogPosition($(".aceDialog"));
          }, 10);
          
          $(".js_setBtn2").live('click', function(){
            $(".js_menuSetBox2").show();
            //qDialog.close();
            //menuDD.find('.js_setBtn').click();
          });
          
          $(".js_msgList").load(siteUrl+'/appmenu/admin/show_content', { 'id':currId }, function(){
            setTimeout(function(){
              
            }, 10);
          });
        },
        'okValue':''
      });
      
      return false;
    }
    
    var _offset = thisObj.offset();
    var _top = _offset.top+27;
    var _left = _offset.left-183;
    
    $(".js_menuSetBox").css({ 'top':_top, 'left':_left }).show();
  });
  
  //  关联到首页
  $(".js_menuIndexBtn").live('click', function(){
    showConfirm('您确定要关联此菜单到微官网首页吗?', 1, function(){
      if (typeof qDialog != 'undefined') {
        qDialog.close();
      }
      
      var currId   = $(".currEditMenu").attr('data-id');
      var postData = { 'id':currId, 'content':-1, 'type':1 };
      saveMenuContent(postData);
    });
  });
  
  // 设置纯文本回复
  $(".js_menuTextBtn1").live('click', function(){
    var tmpContent = "";
    if (typeof qDialog != 'undefined') {
      var msgDiv = $(".aceDialog .js_msgList>div");
      if (msgDiv.length > 0 && msgDiv.attr('data-content-type') == 20) {
        tmpContent = msgDiv.html();
      }
      qDialog.close();
    }
    var html = '<div class="float-prompt-con"><p>在这里填写，点击菜单时返回的纯文本回复</p>\
                <p><textarea class="float-prompt-area js_content">'+tmpContent+'</textarea></p></div>';
    
    ace.dialog({
      'title':'添加文字回复',
      'content':html,
      'init':function(){
        $(".aceFooter .okBtn").css({ 'margin-left':'23px' });
      },
      'ok':function(){
        var content = $(".js_content").val();
        if (!content || !$.trim(content)) {
          showMsg('回复内容不能为空');
          return;
        }
        
        var currId   = $(".currEditMenu").attr('data-id');
        var postData = { 'id':currId, 'content':content, 'type':20 };
        saveMenuContent(postData);
      }
    });
  });
  
  //设置纯文本回复
  $(".js_menuTextBtn").live('click', function(){
    var tmpContent = "";
    if (typeof qDialog != 'undefined') {
      var msgDiv = $(".aceDialog .js_msgList>div");
      if (msgDiv.length > 0 && msgDiv.attr('data-content-type') == 20) {
        tmpContent = msgDiv.html();
      }
      qDialog.close();
    }
    var html = '<div class="float-prompt-con"><p>在这里填写，点击菜单时返回的纯文本回复</p>\
                  <div class="txtwrap">\
                    <div style="min-height:156px; height:auto;" contentEditable="true" class="txtfill js_content">'+tmpContent+'</div>\
                    <div class="txt-options clearfix">\
                      <a href="javascript:void(0);" class="txt-face-btn left js_faceBtn">表情</a>\
                      <p style="display:none;" class="txt-count right js_fontNumBox">还可输入<span>600</span>字</p>\
                    </div>\
                  </div>\
                </div>';
    
    ace.dialog({
      'title':'添加文字回复',
      'content':html,
      'init':function(){
        $(".aceFooter .okBtn").css({ 'margin-left':'23px' });
        
        weiboFace($(".js_faceBtn"), $('.txtwrap .js_content'));
      },
      'ok':function(){
        var content = $(".js_content").html();
        if (!content || !$.trim(content)) {
          showMsg('回复内容不能为空');
          return;
        }
        
        var _num = getNum($(".js_content"));
        if (_num < 1) {
          showMsg('回复的内容不能为空.');
          return;
        }
        if (_num > 600) {
          showMsg('回复的内容不能不能超过600字');
          return;
        }
        
        var currId   = $(".currEditMenu").attr('data-id');
        var postData = { 'id':currId, 'content':content, 'type':20 };
        saveMenuContent(postData);
      }
    });
  });
  
  // 设置链接回复
  $(".js_menuLinkBtn").live('click', function(){
    var tmpContent = "";
    if (typeof qDialog != 'undefined') {
      var msgDiv = $(".aceDialog .js_msgList>div");
      if (msgDiv.length > 0 && msgDiv.attr('data-content-type') == 1) {
        tmpContent = msgDiv.html();
      }
      qDialog.close();
    }
    
    var html = '<div class="float-prompt-con"><p>在这里填写，点击菜单跳转的地址。请填写正确的链接地址</p>\
                <p><input type="text" class="float-prompt-ipt1 js_link" value="'+tmpContent+'"></p></div>';
    
    ace.dialog({
      'title':'点击跳转网页',
      'content':html,
      'init':function(){
        $(".aceFooter .okBtn").css({ 'margin-left':'23px' });
      },
      'ok':function(){
        // 取链接
        var content = $.trim($(".js_link").val());
        if (!content || !$.trim(content)) {
          showMsg('菜单链接不能为空');
          return;
        }
        
        if (!checkStr(content, 'link')) {
          showMsg('链接不能为空');
          return false;
        }
        
        var currId   = $(".currEditMenu").attr('data-id');
        var postData = { 'id':currId, 'content':content, 'type':10 };
        saveMenuContent(postData);
      }
    });
  });
  
  // 设置小程序关联
  $(".js_menuMinipBtn").live('click', function(){
    var tmpAppid = '';
    var tmpPagepath = '';
    var tmpLink = '';
    if (typeof qDialog != 'undefined') {
      var msgDiv = $(".aceDialog .js_msgList>div");
      if (msgDiv.length > 0 && msgDiv.attr('data-content-type') == 60) {
        tmpAppid = $('.aceDialog .js_miniappid').html();
        tmpPagepath = $('.aceDialog .js_minipagepath').html();
        tmpLink = $('.aceDialog .js_minilink').html();
        
        //alert(tmpAppid);
      }
      qDialog.close();
    }
    
    var html = '<div class="float-prompt-con"><p>小程序appid</p>\
                <p><input type="text" class="float-prompt-ipt1 js_miniappid" value="'+tmpAppid+'"></p>\
                <p>小程序路径</p>\
                <p><input type="text" class="float-prompt-ipt1 js_pagepath" value="'+tmpPagepath+'"></p>\
                <p>备用网页 <span style="color:#aaa; font-size:12px;">旧版微信不支持小程序的情况下，会打开备用地址</span></p>\
                <p><input type="text" class="float-prompt-ipt1 js_link" value="'+tmpLink+'"></p></div>';
    
    ace.dialog({
      'title':'点击打开程序',
      'content':html,
      'init':function(){
        $(".aceFooter .okBtn").css({ 'margin-left':'23px' });
      },
      'ok':function(){
        // 取链接
        var miniappid = $.trim($(".js_miniappid").val());
        var pagepath = $.trim($(".js_pagepath").val());
        var link = $.trim($(".js_link").val());
        if (!miniappid) {
          showMsg('小程序appid不能为空');
          return;
        }
        if (!pagepath) {
          showMsg('小程序路径不能为空');
          return;
        }
        if (!link) {
          showMsg('备用网页地址不能为空');
          return;
        }
        
        if (!checkStr(link, 'link')) {
          showMsg('备用链接不正确，请以http开头');
          return false;
        }
        
        var dividStr = miniprogramDevide;
        var content = miniappid+dividStr+pagepath+dividStr+link;
        
        var currId   = $(".currEditMenu").attr('data-id');
        var postData = { 'id':currId, 'content':content, 'type':60 };
        saveMenuContent(postData);
      }
    });
  });
  
  // 设置图文回复
  $(".js_menuSingleBtn, .js_menuMultiBtn").live('click', function(){
    if (typeof qDialog != 'undefined') {
      qDialog.close();
    }
    var msgType = 30;
    var appmsgType = 1;
    if ($(this).hasClass("js_menuMultiBtn")) {
      msgType = 40;
      appmsgType = 2;
    }
    var currId   = $(".currEditMenu").attr('data-id');
    
    var html  = '<div class="float-prompt-con"><p class="float-pic-info">请选择关链到已有的图文信息，或者去&nbsp;<a target="_blank" href="'+siteUrl+'/appmsg/admin/add/'+appmsgType+'">添加新的图文信息</a></p>';
        html += '<div class="js_msgList"><img src="'+siteUrl+'/static/images/loading2.gif"></div></div>';
    
    ace.dialog({
      'title':'选择图文信息',
      'content':html,
      'init':function(){
        $(".aceDialog").width(960);
        $(".aceContent").height(400);
        $(".aceContent").css('overflow', 'auto');
        
        setTimeout(function(){
          resetDialogPosition($(".aceDialog"));
        }, 10);
        $(".js_msgList").load(siteUrl+'/appmenu/admin/get_menu_msg_list', { 'id':currId, 'type':appmsgType }, function(){
          bindMsgEvent(msgType, currId);
        });
        
        $(".js_msgList .page>a").live('click', function(e){
          e.preventDefault();
          var _href = $(this).attr('href');
          $(".js_msgList").load(_href, { 'id':currId, 'type':appmsgType }, function(){
            bindMsgEvent(msgType, currId);
          });
        });
      },
      'okValue':''
    });
  });
  
  // 添加智能回复
  $(".js_menuCustomBtn").live('click', function(){
    $(".js_menuSetBox").hide();
    
    if (typeof qDialog != 'undefined') {
      qDialog.close();
    }
    
    // msgType这里是和关键词回复不同的地方
    var msgType = 50;
    var oldHtml = $(".js_AppCustomHideBox").html();
    $(".js_AppCustomHideBox").html('');
    var tmpSelectData = [];
    qDialog = null;
    ace.dialog({
      'title':'自定义回复',
      'content':oldHtml,
      'init':function(){
        $(".aceDialog").width(680);
        //$(".aceContent").height(400);
        $(".aceContent").css('overflow', 'auto');
        
        var currType    = $(".js_typeSelect").val();
        var currSonType = $(".js_sonTypeSelect"+currType).val();
        //var currSearch  = $.trim($("#js_searchInput").val());
        var queryType   = $.trim($(".js_queryType").val());
        var queryNum   = $.trim($(".js_queryNum").val());
        $(".js_typeSelect").change(function(){
          currType = $(this).val();
          $(".js_sonTypeSelect").hide();
          $(".js_sonTypeSelect"+currType).show();
          againLoad();
          changeAddUrl();
        });
        
        $(".js_sonTypeSelect").change(function(){
          againLoad();
          changeAddUrl();
        });
        
        $(".js_queryType").change(function(){
          queryType   = $.trim($(this).val());
          if (queryType == 2) {
            $(".js_customSelectBox").show();
            $(".js_queryNum").hide();
          } else {
            $(".js_customSelectBox").hide();
            $(".js_queryNum").show();
          }
          
          setTimeout(function(){
            resetDialogPosition($(".aceDialog"));
          }, 10);
          againLoad();
        });
        
        // 拖动选择的顺序
        $(".float-choose-list").sortable({ 
          axis: "y" ,
          opacity: 0.6,
          stop:function(){
          }
        });
      },
      'ok':function(){
        if ($(".aceDialog .okBtn").attr('is_post') == 1) {
          showMsg('提交中，请稍候...');return;
        }
        var currType    = $(".js_typeSelect").val();
        var currSonType = $(".js_sonTypeSelect"+currType).val();
        var queryType   = $.trim($(".js_queryType").val());
        var queryNum    = $.trim($(".js_queryNum").val());
        //var currSearch  = $.trim($(".js_searchInput").val());
        var queryInfo = [];
        $(".js_preCustom").each(function(i){
          queryInfo[i] = $(this).attr('data-id');
        });
        var msgTitle = '文章';
        if (currType == 2) {
          msgTitle = '活动';
        }
        if (queryType == 2) {
          queryNum = queryInfo.length;
        }
        if (queryNum < 1) {
          showMsg('请至少取出一条'+msgTitle+'数据');
          return;
        }
        if (queryNum > 10) {
          showMsg(msgTitle+'数量不能多于10条');
          return;
        }
        
        var postData = { 'type':currType, 'sub_type':currSonType, 'query_type':queryType, 'query_num':queryNum, 
            'info':queryInfo, 'return_son_list':1 };
        $(".aceDialog .okBtn").text('提交中...').attr('is_post', 1);
        $.post(siteUrl+'/appmsg/admin/automsg', postData, function(json){
          $(".aceDialog .okBtn").text('确定').attr('is_post', 0);
          if (json.info != 'ok') {
            showMsg(json.info);
            return false;
          }
          
          var currId   = $(".currEditMenu").attr('data-id');
          var postData = { 'id':currId, 'content':json.content, 'type':50 };
          saveMenuContent(postData, oldHtml);
          
          //$(".js_AppCustomHideBox").html(oldHtml);
          //qDialog.close();
        }, 'json');
      },
      'close':function(){
        $(".js_AppCustomHideBox").html(oldHtml);
        //qDialog.close();
      }
    });
  });
  
  // 保存菜单
  $(".js_okBtn").live('click', function(){
    var thisClosest = $(this).closest(".js_inputBox");
    var menuDD      = $(this).closest(".js_menuDD");
    var id          = menuDD.attr('data-id');
    var parentId    = menuDD.attr('data-parent-id');
    var title       = $(this).prev(".js_input").val();
    
    if (thisClosest.attr('data-is-post') == 1) {
      showMsg('数据提交中，请稍候...')
      return false;
    }
    
    var fill = fillParent;
    // 子级
    if (thisClosest.closest(".js_parentMenu").length < 1) {
      fill = fillSon;
    }
    if (!title || !$.trim(title) || $.trim(title) == fill) {
      showMsg('菜单名称不能为空');
      return false;
    }
    
    var fontNum = getFontNum(title)
    // 父级
    if (parentId < 1 || typeof parentId == "undefined") {
      if (fontNum > 4) {
        showMsg('父级菜单不能不多于4个汉字或8个字母');
        return false;
      }
    } else {
      if (fontNum > 8) {
        showMsg('子级菜单不能不多于8个汉字或16个字母');
        return false;
      }
    }

    thisClosest.attr('data-is-post', 1);
    $.post(siteUrl+'/appmenu/admin/save', { 'title':title, 'id':id, 'parent_id':parentId, 'store_id':storeId, 'res_name':appmenuResname }, function(json){
      thisClosest.attr('data-is-post', 0);
      if (json.info != 'ok') {
        showMsg(json.info);
        return false;
      }
      
      thisClosest.hide();
      menuDD.attr({ 'data-id':json.id, 'data-parent-id':json.parent_id });
      menuDD.find(".menutit").html(json.title);
      thisClosest.prev('div').show();
    }, 'json');
  });
  
  // 删除菜单
  $(".js_delBtn").live('click', function(e){
    var menuDD   = $(this).closest(".js_menuDD");
    var id       = menuDD.attr('data-id');
    var parentId = menuDD.attr('data-parent-id');
    
    if (menuDD.attr('data-is-post') == 1) {
      showMsg('数据提交中，请稍候...')
      return false;
    }
    
    showConfirm('您确定要删除此菜单吗?', 1, function(){
      menuDD.attr('data-is-post', 1);
      $.post(siteUrl+'/appmenu/admin/delete', { 'id':id }, function(json){
        menuDD.attr('data-is-post', 0);
        if (json.info != 'ok') {
          showMsg(json.info);
          return false;
        }
        
        if (parentId > 0) {
          menuDD.remove();
        } else {
          menuDD.siblings(".js_sonMenu").remove();
          menuDD.find(".js_menuItem").hide();
          menuDD.find(".js_inputBox").hide();
          menuDD.find(".js_parentPlaceBox").show();
          menuDD.attr({ 'data-id':0, 'data-parent-id':0 });
        }
        
        // 控制小图标样式
        var thisClosest = menuDD.closest("dl");
        if (thisClosest.find(".js_sonMenu").length < 5) {
          var parentObj = thisClosest.find(".js_parentMenu");
          parentObj.find(".js_addSonBtn").removeClass("icon-add2-disabled");
          
          if (thisClosest.find(".js_sonMenu").length <= 0) {
            parentObj.find(".js_setBtn").removeClass("icon-link-disabled");
          }
        }
      }, 'json');
    });
  });
  
  // 同步菜单
  $(".js_syncMenu").click(function(e){
    e.preventDefault();
    if ($(".js_syncMenu").attr('data-is-post') == 1) {
      // showMsg('数据提交中，请稍候...')
      // return false;
    }
    
    showConfirm('您确定要同步菜单信息到微信公众号吗?', 1, function(){
      $(".js_syncMenu").attr('data-is-post', 1);
      
      $.post(siteUrl+'/appmenu/sync_menu/sync', { 'store_id':storeId, 'res_name':appmenuResname }, function(json){
        $(".js_syncMenu").attr('data-is-post', 0);
        
        if (json.info != 'ok') {
          showMsg(json.info);
          return false;
        }
        
        showMsg('同步成功', 1);
      }, 'json');
    });
  });
  
  // 取消菜单
  $(".js_clearMenu").click(function(e){
    e.preventDefault();
    if ($(".js_clearMenu").attr('data-is-post') == 1) {
      showMsg('数据提交中，请稍候...')
      return false;
    }
    
    showConfirm('您确定要取消微信公众号的自定义菜单吗?', 1, function(){
      $(".js_clearMenu").attr('data-is-post', 1);
      
      $.post(siteUrl+'/appmenu/sync_menu/clear', { }, function(json){
        $(".js_clearMenu").attr('data-is-post', 0);
        
        if (json.info != 'ok') {
          showMsg(json.info);
          return false;
        }
        
        showMsg('清除成功', 1);
      }, 'json');
    });
  });
  
  // 取消店铺个性菜单
  $(".js_clearSpecialMenu").click(function(e){
    e.preventDefault();
    if ($(".js_clearSpecialMenu").attr('data-is-post') == 1) {
      showMsg('数据提交中，请稍候...')
      return false;
    }
    
    showConfirm('您确定要取消微信公众号的自定义菜单吗?', 1, function(){
      $(".js_clearSpecialMenu").attr('data-is-post', 1);
      
      $.post(siteUrl+'/appmenu/admin/sync_menu/clear_specail', { 'store_id':storeId }, function(json){
        $(".js_clearSpecialMenu").attr('data-is-post', 0);
        
        if (json.info != 'ok') {
          showMsg(json.info);
          return false;
        }
        
        showMsg('清除成功', 1);
      }, 'json').error(function(){
        $(".js_clearSpecialMenu").attr('data-is-post', 0);
      });
    });
  });
});

// 取得子菜单的数量
function getSonNum(thisClosest)
{
  return thisClosest.find(".js_sonMenu").length;
}

// 保存菜单内容
function saveMenuContent(_data, oldHtml)
{
  var currEditMenu   = $(".currEditMenu");
  
  if (currEditMenu.attr('data-is-post') == 1) {
    showMsg('数据提交中，请稍候...')
    return false;
  }
  currEditMenu.attr('data-is-post', 1);
  $.post(siteUrl+'/appmenu/admin/save_content', _data, function(json){
    currEditMenu.attr('data-is-post', 0);
    if (json.info != 'ok') {
      showMsg(json.info);
      return false;
    }
    
    //@todo 成功操作后的动作
    currEditMenu.attr('data-content-type', _data.type);
    
    if (oldHtml) {
      $(".js_AppCustomHideBox").html(oldHtml);
    }
    
    showMsg('操作成功', 1);
    if (typeof qDialog != 'undefined') {
      qDialog.close();
    }
  }, 'json');
}

function bindMsgEvent(msgType, currId)
{
  $(".js_msgList>li").unbind('click');
  // 选择某一条图文做为回复
  $(".js_msgList>li").bind('click', function(e){
    e.preventDefault();
    var thisObj = $(this);
    if (!thisObj.hasClass('curr')) {
      var id = thisObj.attr('data-id');
      if (!id) {
        showMsg('请选择一条信息');
        return false;
      }
      
      showConfirm('您确定要选择该图文信息吗?', 1, function(){
        $.post(siteUrl+'/appmenu/admin/save_content', { 'id':currId, 'content':id, 'type':msgType }, function(json){
          if (json.info != 'ok') {
            showMsg(json.info);
            return false;
          }
          
          var currEditMenu   = $(".currEditMenu");
          currEditMenu.attr('data-content-type', msgType);
          
          $(".js_msgList li.curr").removeClass('curr');
          thisObj.addClass('curr');
          
          qDialog.close();
          //window.location.href = siteUrl+'/appmenu/controller/';
        }, 'json');
      });
    }
  });
}
</script>
      </div>
      
    </div>
  </div>
      
      <div class="linkpop js_menuSetBox" style="display:none;">
          <div class="inner-linkpop">
      <span>
        <i class="arrowpop"></i>
        <b class="arrowpop2"></b>
      </span>
              <p class="options-list">
                  <!--<a class="js_menuIndexBtn" href="javascript:void(0);">关联到微官网</a>-->
                  <a class="js_menuLinkBtn" href="javascript:void(0);">跳转到网页</a>
                  <a class="js_menuTextBtn" href="javascript:void(0);">纯文字回复</a>
                  <a class="js_menuSingleBtn" href="javascript:void(0);">单条图文信息</a>
                  <a class="js_menuMultiBtn" href="javascript:void(0);">多条图文信息</a>
                  <a class="js_menuActivityBtn" href="javascript:void(0);">活动回复</a>
                  <!--{*<a class="js_menuImgBtn" href="javascript:void(0);">图片</a>-->
                  <!--<a class="js_menuVoiceBtn" href="javascript:void(0);">声音</a>-->
                  <!--<a class="js_menuCustomBtn" href="javascript:void(0);">智能回复</a>*}-->
              </p>
          </div>
      </div>

</div>
<span class="goTop go-top-box" style="display:none;"></span>
<script>
$(function(){
  // to-top
  goTopEx($(".goTop")[0]);
  // 点击其他地方隐藏弹层
  $(document).click(function(e){
    var s=e.target || e.srcElement;
    // 隐藏图文信息的编辑框
    if (!$(s).is('.js_showSetBoxBtn') && !$(s).is('.js_setBox') && $(s).parents(".js_setBox").size()<1) {
      $(".js_setBox").addClass('hidden');
    }
    
    // 隐藏个人设置弹框
    if (!$(s).is('.js_userSetBtn') && !$(s).is('.js_userSetBox') && $(s).parents(".js_userSetBox").size()<1) {
      $(".js_userSetBox").addClass('hidden');
    }
    
    // 隐藏个人设置弹框
    if (!$(s).is('.js_cardSetBtn') && !$(s).is('.js_cardSetBox') && $(s).parents(".js_cardSetBox").size()<1) {
      $(".js_cardSetBox").addClass('hidden');
    }
    
    // 隐藏菜单设置弹框
    if (!$(s).is('.js_setBtn') && !$(s).is('.js_menuSetBox') && $(s).parents(".js_menuSetBox").size()<1 && !$(s).is('.js_addNewContent') && $(s).parents(".js_addNewContent").size()<1) {
      $(".js_menuSetBox").hide();
    }
    
    // 隐藏表情弹框
    if (!$(s).is('#weiboface') && $(s).parents("#weiboface").size()<1 && !$(s).is('.js_faceBtn') && $(s).parents(".js_faceBtn").size()<1) {
      $("#weiboface").hide();
    }
    
    // 隐藏首页二维码
    if (!$(s).is('.js_mPreviewBtn') && $(s).parents(".js_mPreviewBtn").size()<1 && !$(s).is('.js_mPreviewBox') && $(s).parents(".js_mPreviewBox").size()<1) {
      $(".js_mPreviewBox").hide();
    }
    
    // 隐藏颜色框
    if (!$(s).is('.js_selectColorBtn') && $(s).parents(".js_selectColorBtn").size()<1 && !$(s).is('.js_selectColorBox') && $(s).parents(".js_selectColorBox").size()<1) {
      $(".js_selectColorBox").hide();
    }
    
    // 隐藏图标框
    if (!$(s).is('.js_selectIconBtn') && $(s).parents(".js_selectIconBtn").size()<1 && !$(s).is('.js_selectIconBox') && $(s).parents(".js_selectIconBox").size()<1) {
      $(".js_selectIconBox").hide();
    }
  });

    layui.use(['form', 'laypage'], function () {
        var form = layui.form
            , laypage = layui.laypage;

        laypage.render({ //分页
            elem: 'pages'
            , count: "<?php echo htmlentities($list['total']); ?>"
            , theme: '#FFB800'
            , limit: "<?php echo htmlentities($list['per_page']); ?>"
            , curr: "<?php echo htmlentities($list['current_page']); ?>"
            , jump:function(obj, first) {
                if (!first) {
                    //location.href = "?page="+obj.curr
                    var query = window.location.href;

                    var url = query.split("?")[0]+"?page="+obj.curr;
                    location.href = url;
                }
            }
        });
    });
});
</script>
</body>
</html>